package com.junmeng.jdemo.apng;

import android.os.Bundle;
import android.view.View;

import com.example.common.base.BaseActivityDelegate;
import com.junmeng.jdemo.databinding.ActivityApngBinding;

public class ApngActivity extends BaseActivityDelegate {

    ActivityApngBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityApngBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
//        binding.apngTextView.setApngTargetSize(100,100);
//        binding.apngTextView.setTextIsSelectable(true);
//        binding.apngTextView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
        binding.apngTextView.setText("[1][22][333][1][1][1][22][22][333][333][333][hj[hhh][4]jgg" +
                "3][1][1][1][22][22][333][333][333][hj[hhh]3][1][1][1][22][22][333][333][333][hj[hhh]" +
                "简单高考大捷][hj[hhh]3][1][1][1][22][22]][hj[hhh]3][1][1][1][22][22][1][22][333][4]嘎第三个贷款价格多少来干啥kjgdlgj",-1);
//        binding.apngTextView.setText("[1][22][333][4]");
        binding.apngTextView.setOnClickListener((v)->{
            int rand= (int) (Math.random()*2);
            if(rand==0){
                binding.apngTextView.setText("[1][22][333][4]jgg简单高考大捷[1][22][333][4]嘎第三个贷款价格多少来[1][22][333]lgj",200);
            }else{
                binding.apngTextView.setText("[1][22][333][4][1][22]jgg简单高考大捷[1][22][333][4]嘎第三[1][22]",300);
            }
        });
    }

    public void onClickTest(View view) {
        if( binding.apngTextView.hasSelection()){
            showDebugToast(""+binding.apngTextView.getText().subSequence(binding.apngTextView.getSelectionStart(),binding.apngTextView.getSelectionEnd()));
        }
    }
}